#include<iostream>
#include<opencv2/imgcodecs.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<opencv2/objdetect.hpp>
#include<string>
#include<vector>
#include<cmath>

using namespace std;
using namespace cv;

void jiaodu(Rect r1,Rect r2,Mat img)
{
    Point c1(r1.x+r1.width/2,r1.y+r1.height/2);//待激活区中心点坐标
    Point c2(r2.x+r2.width/2,r2.y+r2.height/2);//R标中心点坐标

    double angle=atan2(c2.y-c1.y,c2.x-c1.x)*180/CV_PI;

    if(angle<0)
    {
        angle += 360;
    }
    
    stringstream anglestr;
    anglestr<<"angle: "<<angle;
    putText(img,anglestr.str(),Point(0,50),FONT_HERSHEY_SIMPLEX,0.7,Scalar(0,255,0),2);

    // cout<<angle<<endl;
}